home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10015 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: surfnet.nl!sun4nl!xs4all!falstaff
  2. From: falstaff@xs4all.nl (Falstaff)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Please help me
  5. Date: 14 Mar 1996 15:01:30 GMT
  6. Organization: XS4ALL, networking for the masses
  7. Message-ID: <4i9cca$9t5@news.xs4all.nl>
  8. References: <4i19fa$kvu@badger.wmin.ac.uk> <4i6tnm$j9e@spanky.pls.ov.com>
  9. NNTP-Posting-Host: xs1.xs4all.nl
  10. X-Newsreader: NN version 6.5.0 #666 (NOV)
  11.  
  12. glenn@ov.com (Fletcher.Glenn@ov.com) writes:
  13.  
  14. >In article kvu@badger.wmin.ac.uk, darec@westminster.ac.uk (Nadarajah Thavaneethan) writes:
  15. >>  Hi there anyone know how to write a C program to read a directory and 
  16. >>  then for each filename in the directory use the stat system call to
  17. >>  obtain the i-node and print the infomation in the form of a long listing.
  18. >>
  19. >>   The program should read the directory name from the keyboard.Then open
  20. >>   the directory. Read each entry in turn and obtain the i-node using stat.
  21.  
  22. Isn't this covered in one of the last chapters of K&R?  open_directory()
  23. or something like that.
  24.  
  25. >I-node you say?  You must be using UNIX.  Why re-invent the wheel?
  26. >Use "ls -l directory_name".
  27.  
  28. That should be "ls -i dirname" or maybe "ls -il dirname", otherwise
  29. you won't get the inode number.
  30.  
  31. Frank
  32. --
  33. The famous GIICM now on line:  http://www.xs4all.nl/~falstaff/GIICM.html
  34. ------------------------------------------------------------------------
  35. Frank A. Vorstenbosch        +31-(70)-355 5241        falstaff@xs4all.nl
  36.